﻿using Xejen.Communication.Endpoints;
using Xejen.Communication.Socket;
using Xejen.Communication.Socket.Communicator;
using Microsoft.Extensions.Configuration;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Xejen.Communication.Sync.Demos
{
    public class Service
    {
        private readonly ISocketCommunicator _communicator;
        private readonly IConfiguration _configuration;
        public Service(ISocketCommunicator communicator, IConfiguration configuration)
        {
            _communicator = communicator;
            _configuration = configuration;
        }

        public async Task<SocketResponse> ExecuteAsync()
        {
            //Addresses addresses = new Addresses();
            //_configuration.Bind(addresses);
            //var result1 = await _communicator.RequestAsync(SocketCommunicationAddress<SocketAddress>.Create(addresses.GetWeatherForecast));

            var address = new SocketAddressWrapper()
            {
                RequestAddress = SocketAddress.Empty
            };

            SocketResponse result1 = await _communicator.SendAsync(address, "fdsa哈根达斯魂牵梦萦人斯柯达  魂牵梦萦为Q@$(*$1硒鼓");
            return result1;
        }
    }
}
